<template>
	<view>
		<navbar title="租赁审核" :autoBack="true"></navbar>
		<view class="con">
			<view class="con__t">
				<u-tabs :list="list4" lineWidth="26rpx" lineHeight='7rpx' lineColor="#3262FD" :activeStyle="{
				            color: '#1E1E1E',
				            fontWeight: 'bold',
				        }" :inactiveStyle="{
				            color: '#949494',
							fontWeight: 'bold',
				        }" itemStyle="padding-left: 73rpx; padding-right: 73rpx; height: 56rpx;font-szie:30rpx;" @click="clicktab">
				</u-tabs>
			</view>
			<view class="con__b">
				<scroll-view scroll-y="true" style="height: 100%;">
					<view class="con__list" v-if="list.length>0">
						<view class="con__list__item" v-for="(item,index) in list" :key="index">
							<view class="u-flex" v-if="item.goodsInfo">
								<image :src="URL(item.goodsInfo.image)" class="con__list__item__pic" mode=""></image>
								<view class="">
									<view class="con__list__item__name u-line-1">
										{{item.goodsInfo.name}}
									</view>
									<view class="con__list__item__t u-line-1">
										规格:{{item.ggtext}}
									</view>
									<view class="con__list__item__t u-line-1">
										租期:{{$u.timeFormat(item.createtime, 'yyyy.mm.dd')}}-{{$u.timeFormat(item.createtime+60*60*24*30*item.qishu, 'yyyy.mm.dd')}}（{{item.qishu*30}}天）
									</view>
									<view class="con__list__item__t u-line-1">
										数量: {{item.num}}
									</view>
								</view>
							</view>
							<view class="u-flex u-flex-y-center u-flex-between" style="margin-top: 23rpx;">

								<view class="con__list__item__status">
									姓名: {{item.name}}
								</view>
								<u-button v-if="item.exam==1" color="#3262FD" @click="navto('/pages/examine/lease?id='+item.id)"
									:customStyle='{width:"106rpx",height:"50rpx",margin:0,padding:0,borderRadius:"5rpx",fontSize:"20rpx",color:"#fff"}'>去审核</u-button>
								<u-button v-if="item.exam==2" color="#3262FD" @click="navto('/pages/examine/lease?id='+item.id)"
									:customStyle='{width:"106rpx",height:"50rpx",margin:0,padding:0,borderRadius:"5rpx",fontSize:"20rpx",color:"#fff"}'>已拒绝</u-button>
								<u-button v-if="item.exam==3" color="#3262FD" @click="navto('/pages/examine/lease?id='+item.id)"
									:customStyle='{width:"106rpx",height:"50rpx",margin:0,padding:0,borderRadius:"5rpx",fontSize:"20rpx",color:"#fff"}'>已审核</u-button>
							</view>
						</view>
					</view>
					<u-empty v-else></u-empty>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	import boos from '@/api/_boos.js'
	export default {
		data() {
			return {
				list4: [{
					name: '待审核',
					status: 1
				}, {
					name: '已拒绝',
					status: 2
				}, {
					name: '已审核',
					status: 3
				}, ],
				status: 1,
				list:[],
				qishulist:[
					{t:1,v:6},
					{t:2,v:12},
					{t:3,v:24},
				],
			};
		},
		methods: {
			clicktab(e) {
				this.status = e.status
				this.getlist()
			},
			async getlist(){
				let res = await boos.order({exam:this.status})
				if(res.data.code==1){
					let gglist=[]
					this.list=res.data.data
					this.list.map(t=>{
						t.qishu=this.qishulist[Number(t.hire_num)-1].v
						JSON.parse(t.spec_json).map(t1=>{
							gglist.push(t1.name)
						})
						t.ggtext=gglist.join(',')
					})
					
				}
			}
		},
		onShow() {
			this.getlist()
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f8f8f8;
	}

	.con {
		&__t {
			height: 104rpx;
			background: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		&__b {
			height: calc(100vh - 44px - var(--status-bar-height) - 104rpx - 72rpx);
			background-color: #f8f8f8;
			padding: 30rpx 30rpx 42rpx;
		}

		&__list {
			&__item {
				background: #FFFFFF;
				border-radius: 20rpx;
				margin-bottom: 30rpx;
				padding: 34rpx 26rpx 30rpx 30rpx;

				&__pic {
					width: 177rpx;
					height: 177rpx;
					background: #3262FD;
					border-radius: 15rpx;
					margin-right: 18rpx;
				}

				&__name {
					width: 410rpx;
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 30rpx;
					color: #1E1E1E;
					line-height: 30rpx;
					margin: 9rpx 0 0;
				}

				&__t {
					width: 410rpx;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #7A7A7A;
					line-height: 24rpx;
					margin-top: 18rpx;
				}

				&__status {
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #78797E;
					line-height: 24rpx;
				}

				.s1 {
					background: #F1F5F8;
					color: #626667;
				}

				.s2 {
					background: rgba(253, 122, 50, .15);
					color: #FD5832;
				}

				.s3 {
					background: #E0E8FF;
					color: #3262FD;
				}

				.s4 {
					background: rgba(36, 173, 36, .2);
					color: #24AD24;
				}

			}
		}
	}
</style>